from django.db import models


# Create your models here.

class User(models.Model):
    """
    用户信息模型类
    """
    username = models.CharField(max_length=50, verbose_name="用户名")
    verCode = models.CharField(max_length=10, verbose_name="验证码")
    password = models.CharField(max_length=50, verbose_name="密码")
    real_name = models.CharField(max_length=50, verbose_name="真实姓名")
    gender = models.CharField(default=False, verbose_name="性别")
    email = models.EmailField(verbose_name="邮箱")
    phone = models.CharField(max_length=11, verbose_name="手机号码")
    qq_num = models.CharField(verbose_name="QQ号码", blank=True)
    province = models.CharField(max_length=20, blank=True, verbose_name="省")
    city = models.CharField(max_length=20, blank=True, verbose_name="市")
    area = models.CharField(max_length=20, blank=True, verbose_name="区")

    # 进行反序列化
    def natural_key(self):
        return {"username": self.username}
